import { takeEvery, put } from 'redux-saga/effects'
import * as types from '@/store/actionTypes'
import axios from 'axios'

function* getInitList() {
    const url = "https://www.easy-mock.com/mock/5f4d9a787e1a7f3146e31669/test/list"
    const res = yield axios.get(url)
    const action = {
        type: 'init_data',
        data: res.data.list
    }
    yield put(action)
}

function* mySaga() {
    yield takeEvery(types.GET_LIST_INFO, getInitList);
}

export default mySaga;